﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace EvriConnector
{
    public enum ContentFormat { RAWXML, RSS, HTML };

    public class FormatConvertor
    {
        private ContentFormat m_format;

        public FormatConvertor(ContentFormat format)
        {
            m_format = format;
        }

        public Stream DoFormatting(StreamReader inStream)
        {
            //tmp
            // Create the XslTransform.
            System.Xml.Xsl.XslTransform xslt = new System.Xml.Xsl.XslTransform();
            // Load the stylesheet.
            xslt.Load("./../../../../EvriConnector/XSLT/rss_evri.xsl");
            // Load the XML data file.
            System.Xml.XPath.XPathDocument doc = new System.Xml.XPath.XPathDocument(inStream);
            System.IO.Stream st = new System.IO.MemoryStream();
            
            System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(st, null);
            // Transform the file.
            xslt.Transform(doc, null, writer);

            st.Seek(0, SeekOrigin.Begin);
            return st;
        }
    }
}
